package com.jeesite.modules.digitalize.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeesite.modules.digitalize.entity.dto.system.reviewproces.DeleteIdListDTO;
import com.jeesite.modules.digitalize.entity.dto.system.reviewproces.ReviewprocesAddDto;
import com.jeesite.modules.digitalize.entity.dto.system.reviewproces.ReviewprocesDto;
import com.jeesite.modules.digitalize.entity.dto.system.reviewproces.ReviewprocesUpdateDto;
import com.jeesite.modules.digitalize.entity.vo.system.reviewproces.ReviewprocesVo;
import com.jeesite.modules.digitalize.service.DigitalizeReviewService;
import com.jeesite.modules.digitalize.util.response.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


@RestController
@Api(tags = "数字-流程管理")
@RequestMapping(value = "${adminPath}/digitalize/review")
public class DigitalizeReviewManageController {

    @Autowired
    private DigitalizeReviewService reviewprocesService;


    @ApiOperation("流程列表")
    @GetMapping("/list")
    public ResultVo<Page<ReviewprocesVo>> pageList(@Validated ReviewprocesDto dto) {
        return ResultVo.success(reviewprocesService.pageList(dto));
    }

    @ApiOperation("流程详情")
//    @ApiImplicitParam(value = "id")
    @GetMapping("details/{id}")
    public ResultVo<ReviewprocesVo> reviewprocesDetails(@PathVariable Long id) {
        return ResultVo.success(reviewprocesService.reviewprocesDetails(id));
    }


    @ApiOperation("新增流程")
    @PostMapping("add")
    //@RequiresPermissions("component:system:review")
    public ResultVo reviewprocesAdd(@RequestBody @Validated ReviewprocesAddDto dto) {
        return reviewprocesService.reviewprocesAdd(dto);
    }


    @ApiOperation(" 编辑流程")
    @PostMapping("update")
    //@RequiresPermissions("component:system:review")
    public ResultVo reviewprocesUpdate(@RequestBody @Validated ReviewprocesUpdateDto dto) {
        return reviewprocesService.reviewprocesUpdate(dto);
    }

    @ApiOperation("删除流程")
    @PostMapping("delete")
    //@RequiresPermissions("component:system:review")
    public ResultVo reviewprocesDel(@RequestBody @Validated DeleteIdListDTO dto) {
        return reviewprocesService.reviewprocesDel(dto);
    }

}
